﻿<%@ page language="java" import="java.util.*,code.bean.*,code.util.*" pageEncoding="UTF-8"%>
<%@ page import="code.util.PageObject" %>
<%
	User loginUser = (User)ParamUtils.getObjectAttribute(session, "loginUser", null);
	PageObject pageObject = (PageObject)ParamUtils.getObjectAttribute(request, "page", null);
	String codeid = ParamUtils.getAttribute(request, "codeid" , "");
	String userid = ParamUtils.getAttribute(request, "userid" , "");
%>
<TABLE width="100%" border="1" cellpadding="0" cellspacing="0" style="border-color: #9f99ef;">
	<%
		if(pageObject.getList().size() > 0)
		{
	%>
	<TR>
		<TD align="center">
			<TABLE width="100%">
				<TR bgcolor="#efefef">
					<TD style="font-size: 20px '黑体'"><b>评论区域</b></TD>
					<TD align="right">
						<%
							if(pageObject.getPageNo() > 1){
						%>
							<A href="javascript:openRemarkSection('<%=codeid%>','<%=pageObject.getPageNo()-1%>');">上一页</A>
						<%
							}else{
								out.print("上一页");
							}
						%>
						<SPAN class=codeSectionLinkSep> | </SPAN>
						<%
							if(pageObject.getPageNo() < pageObject.getPageCount()){
						%>
							<A href="javascript:openRemarkSection('<%=codeid%>','<%=pageObject.getPageNo()+1%>');">下一页</A>
						<%
							}else{
								out.print("下一页");
							}
						%>
						<SPAN> | </SPAN><A title="单击隐藏此项的评论。" href="javascript:closeRemarkSection('<%=codeid%>');">关闭</A>
					</TD>
				</TR>
			</TABLE>
			<div style="padding:2px;"></div>
		</TD>
	</TR>
	<TR>
		<TD align="center">
			<%
			    for(int i = 0;i < pageObject.getList().size(); i++){
			    	Remark remark = (Remark)pageObject.getList().get(i);
			    	if(i > 0){
			    		out.println("<hr width=\"95%\" align=\"center\" style=\"border-top: 2px dashed; border-bottom: 2px dashed; height: 1px ; border-color: white\">");
			    	}
			%>
				<TABLE width="100%">
					<TR>
						<TD class="tdbr"><%=remark.getContent()%>
						<div style="padding:2px;"></div>
						</TD>
					</TR>
					<TR>
						<TD>
							发布者&nbsp;&nbsp;<b><%=remark.getNickName()%></b>&nbsp;&nbsp;-&nbsp;<nobr><%=remark.getPublishTime().substring(0, remark.getPublishTime().length() - 2)%></nobr>
							<%
								if(loginUser != null && loginUser.getId().equals(userid)){
									out.println("|&nbsp;&nbsp;<a href=\"javascript:deleteRemark('" + remark.getId() + "','" + codeid + "','" + pageObject.getPageNo() + "');\">删除</a>");
								}
							%>
						</TD>
					</TR>
				</TABLE>
			<%
			    	
			    }
			%>
		</TD>
	</TR>
	<%
		}
	%>
	<TR>
		<TD align="center">
		    <div style="padding:5px;"></div>
			<TABLE width="100%">
				<TR bgcolor="#efefef">
					<TD style="font-size: 20px '黑体'"><b>发布评论</b></TD>
					<%
						if(pageObject.getList().size() == 0){
							out.println("<TD align=\"right\"><A title=\"单击隐藏此项的评论。\" href=\"javascript:closeRemarkSection('" + codeid + "');\">关闭</A></TD>");
						}
					%>
				</TR>
			</TABLE>
			<div style="padding:2px;"></div>
		</TD>
	</TR>
	<TR>
		<TD align="center">
			<TABLE width="100%">
				<TR>
					<TD>昵称：<input type="text" name="nickName<%=codeid%>" value="<%=loginUser != null ? loginUser.getNickName() : "匆匆过客"%>" size="20"/></TD>
				</TR>
				<TR>
					<TD>
					<div style="padding:2px;"></div>
					评论：</TD>
				</TR>
				<TR>
					<TD><TEXTAREA name="content<%=codeid%>" cols="70" rows="10"></TEXTAREA> </TD>
				</TR>
				<TR>
					<TD>
						<input type="button" class="inputbtn" value="发表评论" onclick="postRemark('<%=codeid%>');">&nbsp;&nbsp;
						<input type="button" class="inputbtn" value="取消" onclick="cancleRemark('<%=codeid%>');">
					</TD>
				</TR>
			</TABLE>
			<input type="hidden" id="hideRemarkNum<%=codeid%>" name="hideRemarkNum<%=codeid%>" value="<%=pageObject.getTotal()%>">
		</TD>
	</TR>
</TABLE>

